<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Animal(name,age) {
            this.name = name
            this.age = age
        }
        // 原型是为了共享方法所有，
        Animal.prototype.formation = function () {
            console.log(`i name is ${this.name},${this.age}years`)
        }

        var obj = new Animal('zhangsan',18)
        obj.formation();
        var obj1 = new Animal('lisi',19)
        obj1.formation()
        console.log(obj.formation === obj1.formation)
        console.log(obj)
    </script>
</body>
</html>